package com.hpjpw.ido.controller;

import java.util.List;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.hpjpw.ido.domain.ResumeReceived;
import com.hpjpw.ido.service.IResumeReceivedService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 简历投递记录Controller
 * 
 * @author hpj
 * @date 2021-04-17
 */
@Api(value ="ResumeReceivedController")
@RestController
@RequestMapping("/ido/received")
public class ResumeReceivedController extends BaseController
{
    @Autowired
    private IResumeReceivedService resumeReceivedService;

    /**
     * 查询简历投递记录列表
     */
    @PreAuthorize("@ss.hasPermi('ido:received:list')")
    @GetMapping("/list")
    @ApiOperation("查询简历投递记录列表")
    public TableDataInfo list(ResumeReceived resumeReceived)
    {
        startPage();
        List<ResumeReceived> list = resumeReceivedService.selectResumeReceivedList(resumeReceived);
        return getDataTable(list);
    }

    /**
     * 导出简历投递记录列表
     */
    @PreAuthorize("@ss.hasPermi('ido:received:export')")
    @Log(title = "简历投递记录", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    @ApiOperation("导出简历投递记录列表")
    public AjaxResult export(ResumeReceived resumeReceived)
    {
        List<ResumeReceived> list = resumeReceivedService.selectResumeReceivedList(resumeReceived);
        ExcelUtil<ResumeReceived> util = new ExcelUtil<ResumeReceived>(ResumeReceived.class);
        return util.exportExcel(list, "received");
    }

    /**
     * 获取简历投递记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('ido:received:query')")
    @GetMapping(value = "/{id}")
    @ApiOperation("获取简历投递记录详细信息")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(resumeReceivedService.selectResumeReceivedById(id));
    }

    /**
     * 新增简历投递记录
     */
    @PreAuthorize("@ss.hasPermi('ido:received:add')")
    @Log(title = "简历投递记录", businessType = BusinessType.INSERT)
    @PostMapping
    @ApiOperation("新增简历投递记录")
    public AjaxResult add(@RequestBody ResumeReceived resumeReceived)
    {
        return toAjax(resumeReceivedService.insertResumeReceived(resumeReceived));
    }

    /**
     * 修改简历投递记录
     */
    @PreAuthorize("@ss.hasPermi('ido:received:edit')")
    @Log(title = "简历投递记录", businessType = BusinessType.UPDATE)
    @PutMapping
    @ApiOperation("修改简历投递记录")
    public AjaxResult edit(@RequestBody ResumeReceived resumeReceived)
    {
        return toAjax(resumeReceivedService.updateResumeReceived(resumeReceived));
    }
//    /**
//     * 修改简历投递状态
//     */
//    @PreAuthorize("@ss.hasPermi('ido:received:editState')")
//    @Log(title = "简历投递记录状态", businessType = BusinessType.UPDATE)
//    @PutMapping
//    @ApiOperation("修改简历投递记录状态")
//    public AjaxResult editState(@RequestParam Long resumeReceivedId,Long state)
//    {
//        return toAjax(resumeReceivedService.updateResumeReceivedState(resumeReceivedId,state));
//    }

    /**
     * 删除简历投递记录
     */
    @PreAuthorize("@ss.hasPermi('ido:received:remove')")
    @Log(title = "简历投递记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    @ApiOperation("删除简历投递记录")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(resumeReceivedService.deleteResumeReceivedByIds(ids));
    }
}
